package com.sp.controller;

import com.sp.pojo.SpReePlatform;
import com.sp.service.SpReePlatformService;
import com.sp.result.Pager;
import com.sp.result.Result;

    import com.sp.common.Annotation;

import java.util.List;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;


/**
*管理
*/
    @Annotation(name = "管理")

@Api(value = "/spReePlatform", tags = {"管理"})
@RestController
@RequestMapping("/spReePlatform")
public class SpReePlatformController{

@Resource
private SpReePlatformService spReePlatformService;


/**
* 增加数据
* @param record
* @return
* @throws Exception
*/
    @Annotation(name = "增加数据")

@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "SpReePlatform", name = "record", value = "")
})
@ApiOperation(value = "增加数据", notes = "增加数据", httpMethod = "POST")
@PostMapping("/insertSpReePlatform")
public  Result insertSpReePlatform(SpReePlatform record)throws Exception{

return Result.insert( spReePlatformService.insertSpReePlatform(record));

}


    /**
    * 删除数据
    * @param spReePlatformId
    * @return
    * @throws Exception
    */
    @Annotation(name = "删除数据")

        @ApiImplicitParams({
            
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "spReePlatformId", value = "")
        })
        @ApiOperation(value = "删除数据", notes = "删除数据", httpMethod = "POST")
    @PostMapping("/deleteSpReePlatformByPrimaryKey")
    public  Result deleteSpReePlatformByPrimaryKey( Integer spReePlatformId )throws Exception{
      return Result.delete(spReePlatformService.deleteSpReePlatformByPrimaryKey(  spReePlatformId ));

    }

    /**
    * 通过主键删除多条数据
    * @param spReePlatformIds
    * @return
    * @throws Exception
    */
    @Annotation(name = "通过主键删除多条数据")

        @ApiImplicitParams({
            
            @ApiImplicitParam(paramType = "query", dataType = "String []", name = "spReePlatformIds", value = "")
        })
        @ApiOperation(value = "通过主键删除多条数据", notes = "通过主键删除多条数据", httpMethod = "POST")
    @PostMapping("/deleteSpReePlatformByIds")
    public  Result deleteSpReePlatformByIds( String [] spReePlatformIds)throws Exception{

    return Result.delete(spReePlatformService.deleteSpReePlatformByIds(  spReePlatformIds ));



    }


    /**
    * 更新数据
    * @param record
    * @return
    * @throws Exception
    */
    @Annotation(name = "更新数据")

        @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "SpReePlatform", name = "record", value = "")
        })
        @ApiOperation(value = "更新数据", notes = "更新数据", httpMethod = "POST")
    @PostMapping("/updateSpReePlatformByPrimaryKey")
    public  Result updateSpReePlatformByPrimaryKey(SpReePlatform record)throws Exception{

    return Result.update(spReePlatformService.updateSpReePlatformByPrimaryKey(record));
    }
    /**
    * 批量更新属性不为空数据
    * @param record
    * @return
    */
    @Annotation(name = "更新属性不为空数据")

    @ApiImplicitParams({
    @ApiImplicitParam(paramType = "query", dataType = "SpReePlatform ", name = "record", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "String []", name = "spReePlatformIds", value = "")
    })
    @ApiOperation(value = "批量更新属性不为空数据", notes = "批量更新属性不为空数据", httpMethod = "POST")

    @PostMapping("/updateSpReePlatformByPrimaryKeyNotNull")

    public  Result updateSpReePlatformByPrimaryKeyNotNull(SpReePlatform record, String [] spReePlatformIds)throws Exception{

    return Result.update(spReePlatformService.updateSpReePlatformByPrimaryKeyNotNull(record,spReePlatformIds));

    }

    /**
    * 通过主键查询数据
    * @param spReePlatformId
    * @return
    */
    @Annotation(name = "通过主键查询数据")
    @ApiImplicitParams({
        
        @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "spReePlatformId", value = "")
     })
    @ApiOperation(value = "通过主键查询数据", notes = "通过主键查询数据", httpMethod = "POST")
    @PostMapping("/selectSpReePlatformByPrimaryKey")
    public  Result<SpReePlatform> selectSpReePlatformByPrimaryKey(  Integer spReePlatformId ){

    return  Result.succeed(spReePlatformService.selectSpReePlatformByPrimaryKey(  spReePlatformId ));

    }


/**
* 通过条件查询数据
* @param spReePlatform
* @param desc
* @param startTime 开始时间
* @param endTime 结束时间
* @param notNullAttributes 不为空筛选  多个,分割
* @param isNullAttributes 为空筛选 多个
* @param globalSearch
* @param likeNameSearch 全局模糊查询 格式 {字段:'条件'}
* @param amountSearch  数值金额全局查询
* @param universalTime    范围查询 格式 {字段:{startTime:'',endTime:''}}
* @param multipleChoiceCondition 多选条件     格式 {字段:[数据,数据]}
* @param fieldConditionStr 高级查询json 格式[{databaseId:'',relationId:'',datas:[]}]
* @return
*/
@Annotation(name = "通过条件查询数据")
    @ApiImplicitParams({
    @ApiImplicitParam(paramType = "query", dataType = "SpReePlatform", name = "spReePlatform", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "desc", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "startTime", value = "开始时间"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "endTime", value = "结束时间"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "notNullAttributes", value = "不为空筛选 多个,分割"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "isNullAttributes", value = "为空筛选 多个"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "globalSearch", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "likeNameSearch", value = "全局模糊查询 格式 {字段:'条件'}"),
    @ApiImplicitParam(paramType = "query", dataType = "double", name = "amountSearch", value = "数值金额全局查询"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "universalTime", value = "范围查询 格式 {字段:{startTime:'',endTime:''}}"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "multipleChoiceCondition", value = "多选条件 格式 {字段:[数据,数据]}"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "fieldConditionStr", value = "高级查询json 格式[{databaseId:'',relationId:'',datas:[]}]")
    })
    @ApiOperation(value = "通过条件查询数据", notes = "通过条件查询数据", httpMethod = "POST")
@PostMapping("/selectSpReePlatform")
public Result<SpReePlatform> selectSpReePlatform(SpReePlatform spReePlatform, String desc, String startTime, String endTime, String notNullAttributes,
String isNullAttributes, String globalSearch,String likeNameSearch, Double amountSearch, String universalTime,String multipleChoiceCondition, String fieldConditionStr){

return Result.succeed(spReePlatformService.selectSpReePlatform(spReePlatform,  desc,  startTime,
endTime,  notNullAttributes,
isNullAttributes,  globalSearch, likeNameSearch,  amountSearch,universalTime,multipleChoiceCondition,fieldConditionStr));

}


/**
* 总条数
* @param spReePlatform
* @param desc
* @param startTime 开始时间
* @param endTime 结束时间
* @param notNullAttributes 不为空筛选  多个,分割
* @param isNullAttributes 为空筛选 多个
* @param globalSearch
* @param likeNameSearch
* @param amountSearch
* @param universalTime    时间 格式 {字段:{startTime:'',endTime:''}}
* @param multipleChoiceCondition 多选条件     格式 {字段:[数据,数据]}
* @return
*/
    @ApiImplicitParams({
    @ApiImplicitParam(paramType = "query", dataType = "SpReePlatform", name = "spReePlatform", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "desc", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "startTime", value = "开始时间"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "endTime", value = "结束时间"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "notNullAttributes", value = "不为空筛选 多个,分割"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "isNullAttributes", value = "为空筛选 多个"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "globalSearch", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "likeNameSearch", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "double", name = "amountSearch", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "universalTime", value = "时间 格式 {字段:{startTime:'',endTime:''}}"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "multipleChoiceCondition", value = "多选条件 格式 {字段:[数据,数据]}"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "fieldConditionStr", value = "")
    })
    @ApiOperation(value = "总条数", notes = "总条数", httpMethod = "POST")
@PostMapping("/getSpReePlatformPageCount")
public Result getSpReePlatformPageCount(SpReePlatform spReePlatform, String desc, String startTime,
String endTime, String notNullAttributes,
String isNullAttributes, String globalSearch,String likeNameSearch, Double amountSearch, String universalTime,String multipleChoiceCondition, String fieldConditionStr){
return Result.succeed( spReePlatformService.getSpReePlatformPageCount(spReePlatform,  desc,  startTime,
 endTime,  notNullAttributes,
 isNullAttributes,  globalSearch, likeNameSearch,  amountSearch,universalTime,multipleChoiceCondition,fieldConditionStr));



}
/**
* 分页获取
* @param page 当前页
* @param limit 每页显示数
* @param initSort 以什么排序
* @param desc 是否降序排序
* @param spReePlatform
* @param startTime 开始时间
* @param endTime 结束时间
* @param notNullAttributes 不为空筛选  多个,分割
* @param isNullAttributes 为空筛选 多个
* @param globalSearch 全局搜素
* @param likeNameSearch 模糊查询 格式 {字段:'条件'}
* @param amountSearch 数值模糊查询
* @param universalTime    时间 格式 {字段:{startTime:'',endTime:''}}
* @param multipleChoiceCondition 多选条件格式 {字段:[数据,数据]}
* @param fieldConditionStr 高级查询json 格式[{databaseId:'',relationId:'',datas:[]}]
* @param isLimit 是否分页  默认true true/false
* @return
*/
@Annotation(name = "分页获取")
    @ApiImplicitParams({
    @ApiImplicitParam(paramType = "query", dataType = "long", name = "page", value = "当前页"),
    @ApiImplicitParam(paramType = "query", dataType = "int", name = "limit", value = "每页显示数"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "initSort", value = "以什么排序"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "desc", value = "是否降序排序"),
    @ApiImplicitParam(paramType = "query", dataType = "SpReePlatform", name = "spReePlatform", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "startTime", value = "开始时间"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "endTime", value = "结束时间"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "notNullAttributes", value = "不为空筛选 多个,分割"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "isNullAttributes", value = "为空筛选 多个"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "globalSearch", value = ""),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "likeNameSearch", value = "模糊查询 格式 {字段:'条件'}"),
    @ApiImplicitParam(paramType = "query", dataType = "double", name = "amountSearch", value = "数值模糊查询"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "universalTime", value = "时间 格式 {字段:{startTime:'',endTime:''}}"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "multipleChoiceCondition", value = "多选条件 格式 {字段:[数据,数据]}"),
    @ApiImplicitParam(paramType = "query", dataType = "string", name = "fieldConditionStr", value = "高级查询json 格式[{databaseId:'',relationId:'',datas:[]}]")
    })
    @ApiOperation(value = "分页获取", notes = "分页获取", httpMethod = "POST")
@PostMapping("/getSpReePlatformPage")
public Pager<SpReePlatform> getSpReePlatformPage(@RequestParam(value = "page", required = false, defaultValue = "0") long page, @RequestParam(value = "limit", required = false, defaultValue = "10") int limit, String initSort, String desc, SpReePlatform spReePlatform,
String startTime, String endTime, String notNullAttributes, String isNullAttributes, String globalSearch, String likeNameSearch,
Double amountSearch, String universalTime,String multipleChoiceCondition, String fieldConditionStr ,String isLimit){

return spReePlatformService.getSpReePlatformPage(page, limit, initSort, spReePlatform, desc, startTime, endTime, notNullAttributes, isNullAttributes, globalSearch,likeNameSearch,amountSearch,universalTime,multipleChoiceCondition,fieldConditionStr,isLimit);

}



}